<template>
  <div class="project flex">
    <div class="project__info flex flex-1">
      <div class="project__info__header flex">
        <img src="@/assets/vue.svg" alt="图片" />
        <div class="info flex-1 flex">
          <span class="id">{{ item.projectId }}</span>
          <span class="title">{{ item.title }}</span>
        </div>
      </div>
      <div class="project__info__footer flex">
        <div class="date">
          <span class="iconfont icon-rili"></span>
          <span>创建于{{ item.date }}</span>
        </div>
        <div class="right">
          <span class="iconfont icon-shuzhishangsheng icon" style="color: #FFBD21;" v-if="item.isUp"></span>
          <span class="iconfont icon-shuzhixiajiang icon" style="color: #0AC947;" v-else></span>
          <span class="status">{{ item.level }}</span>
        </div>
      </div>
    </div>
    <div class="project__data flex-1">
      <span class="project__data__title">项目数据</span>
      <div class="project__data__body flex">
        <div class="item">
          <span>所有任务</span>
          <span>{{ item.task.all }}</span>
        </div>
        <div class="item">
          <span>当前任务</span>
          <span>{{ item.task.current }}</span>
        </div>
        <div class="item">
          <span>执行人</span>
          <div class="avatars">
            <img :src="item.task.executor[0]" alt="图片" v-if="item.task.executor[0]" />
            <img :src="item.task.executor[1]" alt="图片" v-if="item.task.executor[1]" />
            <img :src="item.task.executor[2]" alt="图片" v-if="item.task.executor[2]" />
            <span class="avatarf" v-if="item.task.executor.length > 3">{{ item.task.executor.length - 3 }}+</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { IProject } from '@/types/project';

defineProps<{ item: IProject }>()

</script>

<style scoped lang="scss">
.project {
  background-color: white;
  border-radius: 10px;
  width: 100%;
  margin-top: 20px;

  &__info {
    padding: 25px 30px;
    border-right: 1px solid #e4f4f4;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;

    &__header {
      gap: 20px;

      >img {
        width: 40px;
        height: 40px;
        border-radius: 20px;
        border: 2px solid white;

      }

      .info {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;

        .id {
          font-size: 14px;
          color: #ccc;
        }

        .title {
          font-size: 16px;
        }
      }
    }

    &__footer {
      justify-content: space-between;

      .date {
        display: flex;
        gap: 5px;
        font-size: 12px;
        color: #7D8592;
        align-items: center;

        .icon-rili {
          font-size: 20px;
        }
      }

      .right {
        display: flex;
        color: #FFBD21;
        font-size: 14px;

        .icon {
          font-size: 20px;
        }
      }
    }
  }

  &__data {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;

    &__title {
      font-size: 20px;
    }

    &__body {
      gap: 10px;
      width: 100%;
      justify-content: space-around;

      .item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-family: "PingFang";

        span {
          &:nth-of-type(1) {
            color: #7D8592;
            font-size: 14px;
          }

          &:nth-of-type(2) {
            font-size: 14px;
          }
        }

        .avatars {
          display: flex;

          >* {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            margin-left: -8px;
            border: 2px solid white;
          }

          .avatarf {
            background-color: #3f8cff;
            color: white;
            font-size: 12px;
          }
        }

      }
    }
  }
}
</style>